#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int N = 8e3 + 5;

int num[N], nx[N];

struct Number
{
	int x, num, rk;
};

Number a[N], b[N];

bool cmp(Number sx, Number sy)
{
	if(sx.x == sy.x) return sx.num < sy.num;
	else return sx.x < sy.x;
}

int main()
{
	freopen("sort.in", "r", stdin);
	freopen("sort.out", "w", stdout);
	int n, q;
	scanf("%d%d", &n, &q);
	for(int i = 1; i <= n; ++i )
	{
		scanf("%d", &a[i].x);
		a[i].num = i;
		b[i].x = a[i].x, b[i].num = a[i].num;
	}
	int op, x, v;
	sort(b + 1, b + n + 1, cmp);
	for(int i = 1; i <= n; ++i )
		num[b[i].num] = i;
	while(q--)
	{
		scanf("%d%d", &op, &x);
		if(op == 1)
		{
			scanf("%d", &v);
			a[x].x = v;
			for(int i = 1; i <= n; ++i )
				b[i].x = a[i].x, b[i].num = a[i].num;
			sort(b + 1, b + n + 1, cmp);
			for(int i = 1; i <= n; ++i )
				num[b[i].num] = i;
		} else if(op == 2)
			printf("%d\n", num[x]);		
	}
	fclose(stdin), fclose(stdout);
	return 0;
}
